/**
*      author: Y_Yao
*      created: 2024-09-27 21:32:33
**/

#include<bits/stdc++.h>

using namespace std;
using LL = long long;
const int INF = 0x3f3f3f3f;
map<int,char> ret;
bool vis = false;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    string str1,str2;
    cin >> str1 >> str2;
    int p1 = 0,p2 = 0;
    while(p2 < str2.size())
    {
        if(p2 == str2.size() - 1 && vis == false)
        {
            ret[p1 - 1] = str2[p2];
            int t1 = p1 - 1,t2 = p2;
            while(t1 >= 0 && t2 >= 0 && str1[t1] == str2[t2])
            {
                ret[t1 - 1] = str2[t2];
                t1--,t2--;
            }
            break;
        }
        if(str1[p1] == str2[p2])
        {
            p1++,p2++;
            continue;
        }
        else if(vis == false)
        {
            vis = true;
            ret[p1 - 1] = str2[p2];
            int t1 = p1,t2 = p2;
            while(t1 >= 0 && t2 >= 0 && str1[t1 - 1] == str2[t2])
            {
                ret[t1 - 2] = str2[t2];
                t1--,t2--;
            }
            p2++;
        }
        else
        {
            cout << 0 << endl;
            return 0;
        }
    }

    cout << ret.size() << endl;
    for(auto e : ret)
    {
        cout << e.first + 1 << " " << e.second <<  endl;
    }
    return 0;
}